<?php
include('setup.php');

// πέρνουμε τα πεδία από τη φόρμα μας και τα βάζουμε σε μεταβλητές
$user_level = $_POST['user_level'];
$user_name = $_POST['user_name'];
$user_passwd = md5($_POST['user_passwd']);
$user_fname = $_POST['user_fname'];
$user_lname = $_POST['user_lname'];
$user_locid = $_POST['user_locid'];
$user_phone1 = $_POST['user_phone1'];
$user_phone2 = $_POST['user_phone2'];
$user_gender = $_POST['user_gender'];
$user_email = $_POST['user_email'];
$user_website = $_POST['user_website'];
$user_street_number = $_POST['street_number'];
$user_route = $_POST['route'];
$user_locality = $_POST['locality'];
$user_administrative_area_level_1 = $_POST['administrative_area_level_1'];
$user_postal_code = $_POST['postal_code'];


// δημιουργία αντικειμένου setup
$setup = new setup();

// τρέχω το query μου για insert
$setup->qry("INSERT INTO USERS (user_level, user_name, user_passwd, user_fname, user_lname, user_locid, user_phone1, user_phone2, user_gender, user_email, user_website, user_street_number, user_route, user_locality, user_administrative_area_level_1, user_postal_code) VALUES ('".$user_level."', '".$user_name."', '".$user_passwd."', '".$user_fname."', '".$user_lname."', '".$user_locid."', '".$user_phone1."', '".$user_phone2."', '".$user_gender."', '".$user_email."', '".$user_website."', '".$user_street_number."', '".$user_route."', '".$user_locality."', '".$user_administrative_area_level_1."', '".$user_postal_code."')");

// αν δεν με βγάλει κάποιο error τότε είναι επιτυχημένη η εγγραφή
if($error != "Error")
{
	header( "Location: ../portal.php?userRegistration=success");	
}
else
{
	header( "Location: ../portal.php?userRegistration=failed");	
}

?>